<html xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:t="http://myfaces.apache.org/tomahawk">

<f:view>
<f:loadBundle var="messages" basename="messages"/>

<head>
    <title>#{messages['userList.title']}</title>
    <style type="text/css">
        @import url(#{facesContext.externalContext.requestContextPath}/styles/myfaces.css);
    </style>
</head>

<h:form id="editUser">
<h:commandButton value="Add User" action="add" id="add" immediate="true" styleClass="button"/>

<!-- Error from this table is caused by http://issues.apache.org/jira/browse/TOMAHAWK-466 -->
<t:dataTable id="users" var="user" style="margin-top: 10px"
    value="#{userList.users}" rows="25" sortColumn="#{userList.sortColumn}"
    sortAscending="#{userList.ascending}" styleClass="scrollerTable list"
    headerClass="standardTable_Header" rowClasses="standardTable_Row1,standardTable_Row2"
    columnClasses="standardTable_Column,standardTable_Column,standardTable_Column,standardTable_Column,standardTable_ColumnCentered">
    <t:column>
        <f:facet name="header">
            <t:commandSortHeader columnName="id" arrow="true">
                <h:outputText value="#{messages['user.id']}"/>
            </t:commandSortHeader>
        </f:facet>
        <h:commandLink action="#{userForm.edit}" value="#{user.id}">
            <f:param name="id" value="#{user.id}"/>
        </h:commandLink>
    </t:column>
    <t:column>
        <f:facet name="header">
            <t:commandSortHeader columnName="firstName" arrow="true">
                <h:outputText value="#{messages['user.firstName']}"/>
            </t:commandSortHeader>
        </f:facet>
        <h:outputText value="#{user.firstName}"/>
    </t:column>
    <t:column>
        <f:facet name="header">
            <t:commandSortHeader columnName="lastName" arrow="true">
                <h:outputText value="#{messages['user.lastName']}"/>
            </t:commandSortHeader>
        </f:facet>
        <h:outputText value="#{user.lastName}"/>
    </t:column>
    <t:column>
        <f:facet name="header">
            <t:commandSortHeader columnName="birthday" arrow="true">
                <h:outputText value="#{messages['user.birthday']}"/>
            </t:commandSortHeader>
        </f:facet>
        <h:outputText value="#{user.birthday}"/>
    </t:column>
</t:dataTable>

<ui:include src="/tableFooter.xhtml">
    <ui:param name="tableName" value="users"/>
</ui:include>

<script type="messages/javascript">
    highlightTableRows("editUser:userList");
</script>
</h:form>

</f:view>
</html>